package com.igeek.handler;

import com.igeek.entity.Type;
import com.igeek.json.JsonResult;
import com.igeek.service.TypeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("type")
public class TypeHandler {
    @Resource
    private TypeService typeService;

    @GetMapping("findAll")
    public JsonResult findAll(){
        JsonResult jsonResult = new JsonResult();
        List<Type> typeList = typeService.findAll();
        jsonResult.setState("success");
        jsonResult.setData(typeList);
        return jsonResult;
    }
}
